package severlet;

import bean.Express;
import dao.ExpressDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet(name = "AdminExpressServlet", value = "/AdminExpressServlet")
public class AdminExpressServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");

//        调用数据库
        ExpressDao expressDao=new ExpressDao();
        //查询所有信息
        ArrayList<Express> allExpress = expressDao.getAllExpress();
        //存入Session 跳转
        request.getSession().setAttribute("adminExpress",allExpress);
        request.getRequestDispatcher("admin_expess.jsp").forward(request,response);

    }
}
